home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Palettes / MiscTeePalette / MiscDistributor.subproj / _MiscDistributorConnection.m next >
Encoding:
Text File  |  1994-10-24  |  1.8 KB  |  87 lines

  1. //
  2. //    _MiscDistributorConnection.m -- A helper for MiscDistributor.
  3. //
  4. //        Written by Don Yacktman.  Copyright 1994 by Don Yacktman.
  5. //                Version 1.0  All rights reserved.
  6. //
  7. //        This notice may not be removed from this source code.
  8. //
  9. //    This object is included in the MiscKit by permission from the author
  10. //    and its use is governed by the MiscKit license, found in the file
  11. //    "LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
  12. //    for a list of all applicable permissions and restrictions.
  13. //    
  14.  
  15. #define INSUBPROJ
  16. #import "../_MiscDistributorConnection.h"
  17.  
  18. #define CURRENT_VERSION 1
  19.  
  20. @implementation _MiscDistributorConnection
  21.  
  22. + initialize
  23. {
  24.     // set up class version number and set up the waiting list and
  25.     // distributors dictionary
  26.     if (self == [_MiscDistributorConnection class]) {
  27.         [_MiscDistributorConnection setVersion:CURRENT_VERSION];
  28.     }
  29.     return self;
  30. }
  31.  
  32. - init
  33. {
  34.     connectionName = NULL;
  35.     direction = MiscInout;
  36.     return self;
  37. }
  38.  
  39. - free
  40. {
  41.     if (connectionName) free(connectionName);
  42.     return [super free];
  43. }
  44.  
  45. - (const char *)connectionName { return connectionName; }
  46. - setConnectionName:(const char *)aString
  47. {
  48.     if (connectionName) free(connectionName);
  49.     if (aString)
  50.             connectionName = NXCopyStringBufferFromZone(aString, [self zone]);
  51.     return self;
  52. }
  53.  
  54. - (MiscDCDirection)direction { return direction; }
  55. - setDirection:(MiscDCDirection)aDirection
  56. {
  57.     direction = aDirection;
  58.     return self;
  59. }
  60.  
  61. - read:(NXTypedStream *)stream
  62. {
  63.     int version, d;
  64.  
  65.     [super read:stream];
  66.     version = NXTypedStreamClassVersion(stream,"MiscDistributor");
  67.     if (version == CURRENT_VERSION) {
  68.         NXReadTypes(stream, "*i", &connectionName, &d);
  69.         direction = d;
  70.     } else {
  71.         connectionName = "UNTITLED";
  72.         direction = 0;
  73.     }
  74.     return self;
  75. }
  76.  
  77. - write:(NXTypedStream *)stream
  78. {
  79.     int d = direction;
  80.     [super write:stream];
  81.     NXWriteTypes(stream, "*i", &connectionName, &d);
  82.     return self;
  83. }
  84.  
  85.  
  86. @end
  87.